package com.project.controller;

import com.project.bean.UserBean;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@Controller
@RequestMapping("test")
public class TestController {

    @RequestMapping("/tt")
    public String test(){
        System.out.println("访问到test方法");

        return "/html/index.html";
    }
    @RequestMapping("/speak")
    public String speak(){
        System.out.println("speak");
        return "/html/speak.html";
    }
    @RequestMapping("/add")
    public void add(UserBean bean, HttpServletResponse resp){
        System.out.println(bean);
        resp.setContentType("text/html;charset=utf-8");
        try {
            resp.getWriter().print(bean);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

}
